package cn.stylefeng.guns.modular.storage.service;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.order.entity.OrderPut;
import cn.stylefeng.guns.modular.rest.storagePut.tarpanBatch;
import cn.stylefeng.guns.modular.storage.entity.StoragePutSingle;
import cn.stylefeng.guns.modular.storage.model.params.StoragePutSingleParam;
import cn.stylefeng.guns.modular.storage.model.result.StoragePutSingleResult;
import cn.stylefeng.guns.sys.modular.system.entity.User;
import cn.stylefeng.roses.core.reqres.response.ResponseData;

import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

import org.apache.poi.ss.usermodel.Workbook;

/**
 * 入库单明细表 服务类
 */
public interface StoragePutSingleService extends IService<StoragePutSingle> {

    /**
     * 新增
     */
    void add(StoragePutSingleParam param);

    /**
     * 删除
     */
    void delete(StoragePutSingleParam param);

    /**
     * 更新
     */
    void update(StoragePutSingleParam param);

    /**
     * 查询单条数据，Specification模式
     */
    StoragePutSingleResult findBySpec(StoragePutSingleParam param);

    /**
     * 查询列表，Specification模式
     */
    List<StoragePutSingleResult> findListBySpec(StoragePutSingleParam param);

    List<StoragePutSingleResult> findExportToExcelBySpec(StoragePutSingleParam param, Long operateId);

	/**
	 * app查询列表，Specification模式
	 */
	List<StoragePutSingleResult> customList(StoragePutSingleParam param);


	/**
	 * app查询列表，Specification模式
	 */
	List<StoragePutSingleResult> TcustomList(StoragePutSingleParam param);


    /**
     * 查询分页数据，Specification模式
     */
     LayuiPageInfo findPageBySpec(StoragePutSingleParam param,String condition);

     /**
      * 生成入库单

      */
     ResponseData productionPutSingle(OrderPut orderPut);

	/**
	 * 查询最后一条记录
	 * @return
	 */
	StoragePutSingle findByThelastone();
	
	/**
     * 查询分页数据，去重商品
     *
     * @author zhucx
     * @Date 2019-07-08
     */
	LayuiPageInfo findPageDISTINCTGoods(StoragePutSingleParam storagePutSingleParam);


	/**
	 * 入库工作单查询商品
	 *
	 * @author zhucx
	 * @Date 2019-07-08
	 */
	LayuiPageInfo findPageworkGoods(StoragePutSingleParam storagePutSingleParam);

	/**
	 * 增加批次
	 * @param storagePutSingleParam
	 */
	void increase(StoragePutSingleParam storagePutSingleParam);

	/**
	 * 保存list
	 *
	 */
	boolean saveBatchList(List<StoragePutSingle> list);

	LayuiPageInfo findPageDISTINCTbatch(StoragePutSingleParam storagePutSingleParam);


	List<StoragePutSingleResult> finByOnlyOne(StoragePutSingleParam sp);

	/**
	 * 批量更新
	 * @param List<StoragePutSingle>
	 */
	boolean updateBatchList(List<StoragePutSingle> splist);

	/**
	 * 批量删除
	 * @param List<Integer>
	 */
	boolean batchDelete(List<Integer> pList);

	/**
	 * APP点击入库 查询是否有未入的明细
	 * @param storagePutSingleParam
	 * @return
	 */
	StoragePutSingleResult findBySpecL1(StoragePutSingleParam storagePutSingleParam);

	/**
	 * 批量更新状态
	 * @param List<StoragePutSingle>
	 * @return
	 */
	boolean updateBatchListState(List<StoragePutSingle> list);

	/**
	 * 入库作业审核 查询入库单 库位
	 * @param storagePutSingleParam
	 * @return
	 */
	List<StoragePutSingleResult> findpositionlist(StoragePutSingleParam storagePutSingleParam);
	
	/**
     * APP入库作业审核 
     * 查询库位商品列表
     * @author zhucx
     * @param storageNumber，positionNumber
     * @Date 2019-07-29
     */
	List<StoragePutSingleResult> confirmpositionGoodslist(StoragePutSingleParam storagePutSingleParam);

	/**
	 * 校验库位是否有两种商品
	 * 入库单明细中 状态为未开始的
	 * @param param
	 * @return
	 */
	List<StoragePutSingleResult> checkPositionGoodsNum(StoragePutSingleParam param2);

	int findTrayListRecommend(StoragePutSingleParam param);

    List<StoragePutSingleResult> totalListByGandPSpec(StoragePutSingleParam putDetailedParam);

	void allotPosition(StoragePutSingleParam storagePutSingleParam,User user);

	List<StoragePutSingleResult> totalListBySpec(StoragePutSingleParam putDetailedParam);

    void updateBatchListPosition(List<StoragePutSingleResult> list);

	List<StoragePutSingleResult> referPosition(StoragePutSingleParam putDetailedParam);

	/**
	 * 通过条件和库房id查询一条
	 * @param param
	 * @param warehouseId
	 * @return
	 */
	StoragePutSingleResult findBywarehouseIdSpec(StoragePutSingleParam param, Long warehouseId);

	List<StoragePutSingleResult> findPageDISTINCTGoodsNew(StoragePutSingleParam storagePutSingleParam);

	List<StoragePutSingleResult> findPageDISTINCTbatchNew(StoragePutSingleParam storagePutSingleParam);

	List<tarpanBatch> customListNew(StoragePutSingleParam param);

	void allotPositionNew(StoragePutSingleParam storagePutSingleParam, User user);

	void increaseNew(StoragePutSingleParam storagePutSingleParam, User user);

	List<tarpanBatch> TcustomListNew(StoragePutSingleParam param);

	List<tarpanBatch> confirmpositionGoodslistNew(StoragePutSingleParam param);

	StoragePutSingleResult monthPutCount(StoragePutSingleParam storagePutSingleParam, Long warehouseId);

	LayuiPageInfo findPageBySpecjilu(StoragePutSingleParam storagePutSingleParam, String condition, Long warehouseId,
			Long deptId, Long deliverId,Long operateId);

	void productionPutSingleNew(OrderPut orderPut2, User user);

	List<StoragePutSingleResult> findListBySpecNew(StoragePutSingleParam p2);

	List<StoragePutSingleResult> findListBySpecGroupByGoodsid(StoragePutSingleParam spsP);

	StoragePutSingleResult sumPutByDay(StoragePutSingleParam putSingleParam,Long customerId, Long warehouseId);

	Workbook exportToExcel(StoragePutSingleParam storagePutSingleParam);
}
